package main

import (
    // "fmt"
    // "github.com/mattn/go-gtk/glib"
    "github.com/mattn/go-gtk/gio"
    "github.com/mattn/go-gtk/gtk"
    "os"
)

func main() {
    gtk.Init(&os.Args)

    // window := gtk.NewWindow(gtk.WINDOW_TOPLEVEL)
    // window.SetPosition(gtk.WIN_POS_CENTER)
    // window.SetTitle("GTK Go!")
    // window.SetIconName("gtk-dialog-info")
    // window.Connect("destroy", func(ctx *glib.CallbackContext) {
    //     fmt.Println("got destroy!", ctx.Data().(string))
    //     gtk.MainQuit()
    // }, "foo")

    // //--------------------------------------------------------
    // // GtkVBox
    // vbox := gtk.NewVBox(false, 2)

    // //--------------------------------------------------------
    // // button
    // button := gtk.NewButtonWithLabel("Button with label")
    // button.Clicked(func() {
    //     fmt.Println("button clicked:", button.GetLabel())
    // })
    // vbox.Add(button)

    // //--------------------------------------------------------
    // window.Add(vbox)
    // window.SetSizeRequest(600, 600)
    // window.ShowAll()
    build_ui();
    gtk.Main()

    // let app = Application::builder()
    //     .application_id("org.gtk-rs.example")
    //     .build();

    // // Connect to "activate" signal of `app`
    // app.connect_activate(build_ui);

    // // Set keyboard accelerator to trigger "win.quit".
    // app.set_accels_for_action("win.quit", &["<primary>W"]);

    // // Run the application
    // app.run();
}

func build_ui() {
    // Create a window and set the title
    var window = gtk.NewWindow(gtk.WINDOW_TOPLEVEL)

    // Add action "quit" to `window` taking no parameter
    var action_quit = gio.SimpleAction("quit", None);
    // action_quit.connect_activate(clone!(@weak window => move |_, _| {
    //     window.close();
    // }));
    window.AddAction(action_quit);

    // Present window to the user
    window.ShowAll()
}
// ANCHOR: build_ui
